

//==============================================================================#
//   The confidential and proprietary information contained in this file may
//   only be used by a person authorised under and to the extent permitted
//   by a subsisting licensing agreement from ARM Limited.
//    (C) COPYRIGHT 2008-2010 ARM Limited.
//        ALL RIGHTS RESERVED
//   This entire notice must be reproduced on all copies of this file
//   and copies of this file may only be made by a person if such person is
//   permitted to do so under the terms of a subsisting license agreement
//   from ARM Limited.
//  
//-----------------------------------------------------------------------------
//  Version and Release Control Information:
//  
//  File Revision       : 50638
//  File Date           :  2008-14-10 21:08:37 +0100 (Thu, 09 Oct 2008)
//  
//  Release Information : PL401-r0p1-00eac0
//  
//-----------------------------------------------------------------------------
//  Purpose : Example test for the c vector generation
//
//  Description: Check that the right targets are accessed for 
//               different values of remap
//
//               The test is repeated from every slave_if to each master_if
//               (if a path exists)
//
//               All transactions should be secure in this case
//            
//==============================================================================#
#include "../../../../../shared/validation/c/include/PL301r2.h"

using namespace pl301_namespace;
using namespace arm_namespace;
using namespace frbm_namespace;
using namespace std;


   

int test_cpu_mst_axi4(pl301 &DUT, slave_port * port, unsigned long long address, int remap, int sec, int start_event) 
{

     
     
     //Enable for subspaceMap_0_0x1FF0000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1FF0000_cpu_mst_axi4_state_default = 
         (address >= 0x1FF0000 & address <= 0x1FFFFFF);
     
     //Enable for subspaceMap_0_0x2010000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x2010000_cpu_mst_axi4_state_default = 
         (address >= 0x2010000 & address <= 0xEFFFFFF);
     
     //Enable for subspaceMap_0_0xF000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0xF000000_cpu_mst_axi4_state_default = 
         (address >= 0xF000000 & address <= 0xF0FFFFF);
     
     //Enable for subspaceMap_0_0x10000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10000000_cpu_mst_axi4_state_default = 
         (address >= 0x10000000 & address <= 0x10000FFF);
     
     //Enable for subspaceMap_0_0x10001000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10001000_cpu_mst_axi4_state_default = 
         (address >= 0x10001000 & address <= 0x10001FFF);
     
     //Enable for subspaceMap_0_0x10002000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10002000_cpu_mst_axi4_state_default = 
         (address >= 0x10002000 & address <= 0x10002FFF);
     
     //Enable for subspaceMap_0_0x10003000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10003000_cpu_mst_axi4_state_default = 
         (address >= 0x10003000 & address <= 0x10003FFF);
     
     //Enable for subspaceMap_0_0x10004000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10004000_cpu_mst_axi4_state_default = 
         (address >= 0x10004000 & address <= 0x10004FFF);
     
     //Enable for subspaceMap_0_0x10005000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10005000_cpu_mst_axi4_state_default = 
         (address >= 0x10005000 & address <= 0x10005FFF);
     
     //Enable for subspaceMap_0_0x10006000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10006000_cpu_mst_axi4_state_default = 
         (address >= 0x10006000 & address <= 0x10006FFF);
     
     //Enable for subspaceMap_0_0x10007000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10007000_cpu_mst_axi4_state_default = 
         (address >= 0x10007000 & address <= 0x10007FFF);
     
     //Enable for subspaceMap_0_0x10008000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10008000_cpu_mst_axi4_state_default = 
         (address >= 0x10008000 & address <= 0x10008FFF);
     
     //Enable for subspaceMap_0_0x10009000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10009000_cpu_mst_axi4_state_default = 
         (address >= 0x10009000 & address <= 0x10009FFF);
     
     //Enable for subspaceMap_0_0x1000A000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000A000_cpu_mst_axi4_state_default = 
         (address >= 0x1000A000 & address <= 0x1000AFFF);
     
     //Enable for subspaceMap_0_0x1000B000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000B000_cpu_mst_axi4_state_default = 
         (address >= 0x1000B000 & address <= 0x1000BFFF);
     
     //Enable for subspaceMap_0_0x1000C000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000C000_cpu_mst_axi4_state_default = 
         (address >= 0x1000C000 & address <= 0x1000CFFF);
     
     //Enable for subspaceMap_0_0x1000D000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000D000_cpu_mst_axi4_state_default = 
         (address >= 0x1000D000 & address <= 0x1000DFFF);
     
     //Enable for subspaceMap_0_0x1000E000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000E000_cpu_mst_axi4_state_default = 
         (address >= 0x1000E000 & address <= 0x1000EFFF);
     
     //Enable for subspaceMap_0_0x1000F000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x1000F000_cpu_mst_axi4_state_default = 
         (address >= 0x1000F000 & address <= 0x1000FFFF);
     
     //Enable for subspaceMap_0_0x10010000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10010000_cpu_mst_axi4_state_default = 
         (address >= 0x10010000 & address <= 0x10010FFF);
     
     //Enable for subspaceMap_0_0x10011000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10011000_cpu_mst_axi4_state_default = 
         (address >= 0x10011000 & address <= 0x10011FFF);
     
     //Enable for subspaceMap_0_0x10012000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10012000_cpu_mst_axi4_state_default = 
         (address >= 0x10012000 & address <= 0x10012FFF);
     
     //Enable for subspaceMap_0_0x10013000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10013000_cpu_mst_axi4_state_default = 
         (address >= 0x10013000 & address <= 0x10013FFF);
     
     //Enable for subspaceMap_0_0x10014000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10014000_cpu_mst_axi4_state_default = 
         (address >= 0x10014000 & address <= 0x10014FFF);
     
     //Enable for subspaceMap_0_0x10015000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10015000_cpu_mst_axi4_state_default = 
         (address >= 0x10015000 & address <= 0x10015FFF);
     
     //Enable for subspaceMap_0_0x10016000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10016000_cpu_mst_axi4_state_default = 
         (address >= 0x10016000 & address <= 0x10016FFF);
     
     //Enable for subspaceMap_0_0x10017000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10017000_cpu_mst_axi4_state_default = 
         (address >= 0x10017000 & address <= 0x10017FFF);
     
     //Enable for subspaceMap_0_0x10018000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x10018000_cpu_mst_axi4_state_default = 
         (address >= 0x10018000 & address <= 0x10018FFF);
     
     //Enable for subspaceMap_0_0x30000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x30000000_cpu_mst_axi4_state_default = 
         (address >= 0x30000000 & address <= 0x3FFFFFFF);
     
     //Enable for subspaceMap_0_0x40000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x40000000_cpu_mst_axi4_state_default = 
         (address >= 0x40000000 & address <= 0x7FFFFFFF);
     
     //Enable for subspaceMap_0_0x80000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0x80000000_cpu_mst_axi4_state_default = 
         (address >= 0x80000000 & address <= 0x9FFFFFFF);
     
     //Enable for subspaceMap_0_0xA0000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0xA0000000_cpu_mst_axi4_state_default = 
         (address >= 0xA0000000 & address <= 0xBFFFFFFF);
     
     //Enable for subspaceMap_0_0xC0000000_cpu_mst_axi4_state_default
     bool subspaceMap_0_0xC0000000_cpu_mst_axi4_state_default = 
         (address >= 0xC0000000 & address <= 0xFFFFFFFF);
     

     //Determine if there was a match
     if (subspaceMap_0_0x1FF0000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x2010000_cpu_mst_axi4_state_default |
             subspaceMap_0_0xF000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10001000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10002000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10003000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10004000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10005000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10006000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10007000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10008000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10009000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000A000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000B000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000C000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000D000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000E000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x1000F000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10010000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10011000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10012000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10013000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10014000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10015000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10016000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10017000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x10018000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x30000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x40000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0x80000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0xA0000000_cpu_mst_axi4_state_default |
             subspaceMap_0_0xC0000000_cpu_mst_axi4_state_default) {

         //Match to real location so send   
         DUT.write(port, NULL, address, rand(), 0x1111, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, rand(), 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

     } else {

         //Default slave access override to decerr
         DUT.write(port, NULL, address, 0, 0x1111, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, 0, 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;
     };

     return start_event;
};

int test_cpu_mst_axi4(pl301 &DUT, int start_event, int remap)
{


  //Set the current master
  current_master = &(DUT.slave_ports["cpu_mst_axi4"]);

  //Get the current rsb_master
  slave_port * rsb_master;
  rsb_master = DUT.get_rsb_master();
  bool secure = false;
  int  sec_reg = 0;
  int sec = 0;

  //Now test every address connection that is present in the current remap

      

  DUT.comment(current_master, "Testing 0x1FF0000 remap is " + to_string(remap));
  

         if (0x1FF0000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1FF0000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1FF0000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1FF0000 + ((0x10000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1FF0000 + 0x10000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1FF0000 + 0x10000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1FF0000 + 0x10000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x2010000 remap is " + to_string(remap));
  

         if (0x2010000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x2010000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x2010000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x2010000 + ((0xCFF0000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x2010000 + 0xCFF0000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x2010000 + 0xCFF0000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x2010000 + 0xCFF0000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0xF000000 remap is " + to_string(remap));
  

         if (0xF000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0xF000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0xF000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xF000000 + ((0x100000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xF000000 + 0x100000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0xF000000 + 0x100000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xF000000 + 0x100000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10000000 remap is " + to_string(remap));
  

         if (0x10000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10000000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10000000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10000000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10000000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10001000 remap is " + to_string(remap));
  

         if (0x10001000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10001000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10001000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10001000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10001000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10001000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10001000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10002000 remap is " + to_string(remap));
  

         if (0x10002000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10002000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10002000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10002000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10002000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10002000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10002000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10003000 remap is " + to_string(remap));
  

         if (0x10003000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10003000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10003000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10003000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10003000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10003000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10003000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10004000 remap is " + to_string(remap));
  

         if (0x10004000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10004000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10004000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10004000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10004000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10004000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10004000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10005000 remap is " + to_string(remap));
  

         if (0x10005000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10005000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10005000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10005000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10005000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10005000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10005000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10006000 remap is " + to_string(remap));
  

         if (0x10006000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10006000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10006000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10006000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10006000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10006000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10006000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10007000 remap is " + to_string(remap));
  

         if (0x10007000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10007000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10007000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10007000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10007000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10007000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10007000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10008000 remap is " + to_string(remap));
  

         if (0x10008000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10008000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10008000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10008000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10008000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10008000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10008000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10009000 remap is " + to_string(remap));
  

         if (0x10009000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10009000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10009000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10009000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10009000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10009000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10009000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000A000 remap is " + to_string(remap));
  

         if (0x1000A000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000A000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000A000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000A000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000A000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000A000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000A000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000B000 remap is " + to_string(remap));
  

         if (0x1000B000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000B000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000B000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000B000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000B000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000B000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000B000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000C000 remap is " + to_string(remap));
  

         if (0x1000C000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000C000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000C000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000C000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000C000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000C000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000C000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000D000 remap is " + to_string(remap));
  

         if (0x1000D000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000D000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000D000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000D000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000D000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000D000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000D000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000E000 remap is " + to_string(remap));
  

         if (0x1000E000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000E000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000E000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000E000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000E000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000E000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000E000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x1000F000 remap is " + to_string(remap));
  

         if (0x1000F000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000F000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x1000F000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000F000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000F000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x1000F000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x1000F000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10010000 remap is " + to_string(remap));
  

         if (0x10010000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10010000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10010000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10010000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10010000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10010000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10010000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10011000 remap is " + to_string(remap));
  

         if (0x10011000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10011000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10011000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10011000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10011000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10011000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10011000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10012000 remap is " + to_string(remap));
  

         if (0x10012000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10012000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10012000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10012000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10012000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10012000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10012000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10013000 remap is " + to_string(remap));
  

         if (0x10013000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10013000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10013000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10013000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10013000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10013000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10013000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10014000 remap is " + to_string(remap));
  

         if (0x10014000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10014000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10014000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10014000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10014000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10014000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10014000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10015000 remap is " + to_string(remap));
  

         if (0x10015000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10015000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10015000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10015000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10015000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10015000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10015000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10016000 remap is " + to_string(remap));
  

         if (0x10016000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10016000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10016000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10016000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10016000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10016000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10016000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10017000 remap is " + to_string(remap));
  

         if (0x10017000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10017000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10017000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10017000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10017000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10017000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10017000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x10018000 remap is " + to_string(remap));
  

         if (0x10018000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x10018000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x10018000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10018000 + ((0x1000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10018000 + 0x1000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x10018000 + 0x1000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x10018000 + 0x1000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x30000000 remap is " + to_string(remap));
  

         if (0x30000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x30000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x30000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x30000000 + ((0x10000000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x30000000 + 0x10000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x30000000 + 0x10000000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x30000000 + 0x10000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x40000000 remap is " + to_string(remap));
  

         if (0x40000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x40000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x40000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + ((0x40000000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + 0x40000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x40000000 + 0x40000000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + 0x40000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x80000000 remap is " + to_string(remap));
  

         if (0x80000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0x80000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0x80000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + ((0x20000000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + 0x20000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x80000000 + 0x20000000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + 0x20000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0xA0000000 remap is " + to_string(remap));
  

         if (0xA0000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0xA0000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0xA0000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + ((0x20000000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + 0x20000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0xA0000000 + 0x20000000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + 0x20000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0xC0000000 remap is " + to_string(remap));
  

         if (0xC0000000 > 4) {
             start_event = test_cpu_mst_axi4(DUT, current_master, 0xC0000000 - 4, remap, sec, start_event);
         }
         start_event = test_cpu_mst_axi4(DUT, current_master, 0xC0000000, remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + ((0x40000000) >> 1)), remap, sec, start_event);
         start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + 0x40000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0xC0000000 + 0x40000000) - 1) {
            start_event = test_cpu_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + 0x40000000), remap, sec, start_event);
         }
  
  return start_event;

};

   

int test_dma_axi4_cpu_s(pl301 &DUT, slave_port * port, unsigned long long address, int remap, int sec, int start_event) 
{

     
     
     //Enable for subspaceMap_dma_axi4_cpu_ib
     bool subspaceMap_dma_axi4_cpu_ib = 
         (address >= 0x0000 & address <= 0xFFFFFFFF);
     

     //Determine if there was a match
     if (subspaceMap_dma_axi4_cpu_ib) {

         //Match to real location so send   
         DUT.write(port, NULL, address, rand(), 0x1111, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, rand(), 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

     } else {

         //Default slave access override to decerr
         DUT.write(port, NULL, address, 0, 0x1111, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, 0, 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;
     };

     return start_event;
};

int test_dma_axi4_cpu_s(pl301 &DUT, int start_event, int remap)
{


  //Set the current master
  current_master = &(DUT.slave_ports["dma_axi4_cpu_s"]);

  //Get the current rsb_master
  slave_port * rsb_master;
  rsb_master = DUT.get_rsb_master();
  bool secure = false;
  int  sec_reg = 0;
  int sec = 0;

  //Now test every address connection that is present in the current remap

      

  DUT.comment(current_master, "Testing 0x0000 remap is " + to_string(remap));
  

         if (0x0000 > 4) {
             start_event = test_dma_axi4_cpu_s(DUT, current_master, 0x0000 - 4, remap, sec, start_event);
         }
         start_event = test_dma_axi4_cpu_s(DUT, current_master, 0x0000, remap, sec, start_event);
         start_event = test_dma_axi4_cpu_s(DUT, current_master, ((unsigned long long)0x0000 + ((((unsigned long long)0xFFFFFFFF - 0x0000 + 1)) >> 1)), remap, sec, start_event);
         start_event = test_dma_axi4_cpu_s(DUT, current_master, ((unsigned long long)0x0000 + ((unsigned long long)0xFFFFFFFF - 0x0000 + 1) - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x0000 + ((unsigned long long)0xFFFFFFFF - 0x0000 + 1)) - 1) {
            start_event = test_dma_axi4_cpu_s(DUT, current_master, ((unsigned long long)0x0000 + ((unsigned long long)0xFFFFFFFF - 0x0000 + 1)), remap, sec, start_event);
         }
  
  return start_event;

};

   

int test_vgalcd_mst_axi4(pl301 &DUT, slave_port * port, unsigned long long address, int remap, int sec, int start_event) 
{

     
     
     //Enable for subspaceMap_0_0x40000000_vgalcd_mst_axi4_state_default
     bool subspaceMap_0_0x40000000_vgalcd_mst_axi4_state_default = 
         (address >= 0x40000000 & address <= 0x7FFFFFFF);
     
     //Enable for subspaceMap_0_0x80000000_vgalcd_mst_axi4_state_default
     bool subspaceMap_0_0x80000000_vgalcd_mst_axi4_state_default = 
         (address >= 0x80000000 & address <= 0x9FFFFFFF);
     
     //Enable for subspaceMap_0_0xA0000000_vgalcd_mst_axi4_state_default
     bool subspaceMap_0_0xA0000000_vgalcd_mst_axi4_state_default = 
         (address >= 0xA0000000 & address <= 0xBFFFFFFF);
     
     //Enable for subspaceMap_0_0xC0000000_vgalcd_mst_axi4_state_default
     bool subspaceMap_0_0xC0000000_vgalcd_mst_axi4_state_default = 
         (address >= 0xC0000000 & address <= 0xFFFFFFFF);
     

     //Determine if there was a match
     if (subspaceMap_0_0x40000000_vgalcd_mst_axi4_state_default |
             subspaceMap_0_0x80000000_vgalcd_mst_axi4_state_default |
             subspaceMap_0_0xA0000000_vgalcd_mst_axi4_state_default |
             subspaceMap_0_0xC0000000_vgalcd_mst_axi4_state_default) {

         //Match to real location so send   
         DUT.write(port, NULL, address, rand(), 0x1111, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, rand(), 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         start_event++;

     } else {

         //Default slave access override to decerr
         DUT.write(port, NULL, address, 0, 0x1111, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;

         //Read from one below the base address
         DUT.read(port, NULL, address, 0, 0xffffffff, 0, start_event + 1, start_event, (sec == 0));
         if ((*port).transactions.back().protocol == 1) {
             (*port).transactions.back().resp[0] = axi_decerr;
         } else {
             (*port).transactions.back().resp[0] = ahb_error;
         }
         start_event++;
     };

     return start_event;
};

int test_vgalcd_mst_axi4(pl301 &DUT, int start_event, int remap)
{


  //Set the current master
  current_master = &(DUT.slave_ports["vgalcd_mst_axi4"]);

  //Get the current rsb_master
  slave_port * rsb_master;
  rsb_master = DUT.get_rsb_master();
  bool secure = false;
  int  sec_reg = 0;
  int sec = 0;

  //Now test every address connection that is present in the current remap

      

  DUT.comment(current_master, "Testing 0x40000000 remap is " + to_string(remap));
  

         if (0x40000000 > 4) {
             start_event = test_vgalcd_mst_axi4(DUT, current_master, 0x40000000 - 4, remap, sec, start_event);
         }
         start_event = test_vgalcd_mst_axi4(DUT, current_master, 0x40000000, remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + ((0x40000000) >> 1)), remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + 0x40000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x40000000 + 0x40000000) - 1) {
            start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x40000000 + 0x40000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0x80000000 remap is " + to_string(remap));
  

         if (0x80000000 > 4) {
             start_event = test_vgalcd_mst_axi4(DUT, current_master, 0x80000000 - 4, remap, sec, start_event);
         }
         start_event = test_vgalcd_mst_axi4(DUT, current_master, 0x80000000, remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + ((0x20000000) >> 1)), remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + 0x20000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0x80000000 + 0x20000000) - 1) {
            start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0x80000000 + 0x20000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0xA0000000 remap is " + to_string(remap));
  

         if (0xA0000000 > 4) {
             start_event = test_vgalcd_mst_axi4(DUT, current_master, 0xA0000000 - 4, remap, sec, start_event);
         }
         start_event = test_vgalcd_mst_axi4(DUT, current_master, 0xA0000000, remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + ((0x20000000) >> 1)), remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + 0x20000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0xA0000000 + 0x20000000) - 1) {
            start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xA0000000 + 0x20000000), remap, sec, start_event);
         }
      

  DUT.comment(current_master, "Testing 0xC0000000 remap is " + to_string(remap));
  

         if (0xC0000000 > 4) {
             start_event = test_vgalcd_mst_axi4(DUT, current_master, 0xC0000000 - 4, remap, sec, start_event);
         }
         start_event = test_vgalcd_mst_axi4(DUT, current_master, 0xC0000000, remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + ((0x40000000) >> 1)), remap, sec, start_event);
         start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + 0x40000000 - 4), remap, sec, start_event);
         if (0x31 > ((unsigned long long)0xC0000000 + 0x40000000) - 1) {
            start_event = test_vgalcd_mst_axi4(DUT, current_master, ((unsigned long long)0xC0000000 + 0x40000000), remap, sec, start_event);
         }
  
  return start_event;

};



//main program
int main(int argc, char *argv[])
{
    //Instance PL301
    pl301 DUT(argv[1],argv[2]);

    //transactions
    transaction * trans;
    
    //define an iterator for the master ports
    master_iter this_master;

    //define an interator for the slave ports
    slave_iter this_slave;
    //name the test - used later for the tsf file
    test_name = "addr_map";
    
    // rsb master for changing remap states
    slave_port * rsb_master;

    //Start event
    int start_event = 0;
    int remap_val = 0;

    
        // Test port cpu_mst_axi4
        start_event = test_cpu_mst_axi4(DUT, start_event, remap_val);
    
        // Test port dma_axi4_cpu_s
        start_event = test_dma_axi4_cpu_s(DUT, start_event, remap_val);
    
        // Test port vgalcd_mst_axi4
        start_event = test_vgalcd_mst_axi4(DUT, start_event, remap_val);
    

    DUT.generate();
}
